
package es.upm.dit.gsi.opactv;

import java.util.ArrayList;

public class Book {

    private String title, author, description, cover;
    private ArrayList<String> tags = new ArrayList();
    private ArrayList<String[]> optionals = new ArrayList();

    public Book(String title, String author) {
        this.title = title;
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public String getAuthor() {
        return author;
    }
    
    public String getDescription() {
        return description;
    }
    
    public ArrayList<String> getTags() {
        return tags;
    }
    
    public String getCover() {
        return cover;
    }

    public String getOptional(String type) {
        for (String[] optional : optionals) {
            if (optional[0].equals(type)) return optional[1];
        }
        return "";
    }
    
    public void addDescription(String description) {
        this.description = description;
    }

    public void addTag(String tag) {
        tags.add(tag);
    }

    public void addCover(String cover) {
        this.cover = cover;
    }

    public void addOptional(String type, String data) {
        String[] optional = {type,data};
        optionals.add(optional);
    }

}
